<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
?>

<!-- JavaScript -->
<script type="text/javascript" src="<?= base_url() ?>js/wufoo.js"></script>
<script src="<?= base_url() ?>js/chosen.jquery.js" type="text/javascript"></script>
<!-- CSS -->
<!--<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />-->
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>css/datepicker.css" media="screen, tv, projection" title="Default" />
<script type="text/javascript" src="<?= base_url() ?>js/datepicker.js"></script>
<link rel="stylesheet" href="<?php echo base_url() ?>css/chosen.css" />

<div id="container">
	<?
    //Setting Awal Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
	// $param_exp=explode("#",$param_id);
	$value = array(
		'id'			=> "",
		'jamke'			=> "",
		'jam_mulai'		=> "",
		'menit_mulai'	=> "",
		'jam_selesai'	=> "",
		'menit_selesai'	=> "",
		'keterangan'	=> "",
		'legend'				=> "Form Input Jadwal Jam Belajar",
		'info'					=> "Form input Jadwal Jam Belajar",
		'act_form'				=> "jadwal_jam_belajar/input_jadwalbelajar/"
	);
	
	//Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
	if($status == "edit"){
		foreach($rs_jadwalbelajar->result() as $row){
			$value['id'] = $row->ID_JJB;
			$value['jamke'] = $row->JAM_KE;
			$value['mulai'] = $row->JAM_MULAI;
			$value['selesai'] = $row->JAM_SELESAI;
			$value['keterangan'] = $row->KETERANGAN;
		}
		$exp_mulai = explode(':',$value['mulai']);
		$value['jam_mulai'] = $exp_mulai[0];
		$value['menit_mulai'] = $exp_mulai[1];
		
		$exp_selesai = explode(':',$value['selesai']);
		$value['jam_selesai'] = $exp_selesai[0];
		$value['menit_selesai'] = $exp_selesai[1];
		
		$value['legend'] = "Form Jadwal Jam Belajar";
		$value['info'] = "Form Jadwal Jam Belajar";
		$value['act_form'] = "jadwal_jam_belajar/edit_jadwalbelajar/".$value['id'];
	}//end if
	
	?>
	<?= form_open($value["act_form"],'class="wufoo" onSubmit="return validate()" name="form_jenisujian"'); ?>
	<fieldset class="fieldset">
	<legend class="legend">
		<?= $value["legend"] ?> |
	</legend>
	
	<div class="info">
		<div><?= $value["info"] ?></div>
	</div>
	<div>
		<?= anchor(site_url('jadwal_jam_belajar/'),img(array('src'=>'images/main/38.png','border'=>'0','alt'=>'')).' Kembali ke daftar Jadwal Jam Belajar','Menampilkan halaman Daftar Jadwal Jam Belajar'); ?>
	
	</div>
	<?php if (!empty($err_msg)): ?>
		<div class="ret_error">
			<?php echo $err_msg; ?>
		</div>
	<?php endif; ?>
 <!-- Konten -------------------------------------------------------------------------->
 <div id="contentform">
	<?php echo form_error('jamke'); ?>
	<?php echo form_error('jam_mulai'); ?>
	<?php echo form_error('menit_mulai'); ?>
	<?php echo form_error('jam_selesai'); ?>
	<?php echo form_error('menit_selesai'); ?>
	<?php echo form_error('keterangan'); ?>
	
	<ul>
		<?php if($this->session->userdata('roleid')=='0'){ //diknas ?>
		<li>
			<label class="desc">Nama Sekolah *</label>
			 <div>
                <? 
                //list sekolah
				$options_sekolah[''] = "-- Pilih Sekolah --";
				foreach($sekolah->result() as $row_sekolah){
					$options_sekolah[$row_sekolah->ID_SEKOLAH] = $row_sekolah->NAMA_SEKOLAH; 
				}
				echo form_dropdown('nama_sekolah',$options_sekolah,$value['id_sekolah'],'class="field select"');	
                ?>
            </div>
            <p class="instruct">
                Pilih Sekolah Pada Kolom ini, jika tidak ada dalam daftar maka inputkan pada Data Sekolah terlebih dahulu.			
            </p>
		</li>
		<?php echo form_error('nama_sekolah'); ?>
		<?}?>
		
		<li>
			<label class="desc">Jam Ke *</label>
			<div>
				<input class="field text" type="text" maxlength="2" size="3" name="jamke" value="<? if(set_value('jamke')!='') echo set_value('jamke'); else echo $value['jamke'];?>"/> 
				<input type="hidden" id="jamke_asli" name="jamke_asli" value="<?php echo  $value['jamke'];?>">
			</div>
			<p class="instruct">
				Masukkan Jam Ke Pada Kolom ini.			
			</p>
		</li>
		

		<li>
			<label class="desc">Jam Mulai *</label>
			<div>
				<input class="field text" type="text" maxlength="2" size="2" name="jam_mulai" value="<? if(set_value('jam_mulai')!='') echo set_value('jam_mulai'); else echo $value['jam_mulai'];?>"/> 
				: <input class="field text" type="text" maxlength="2" size="2" name="menit_mulai" value="<? if(set_value('menit_mulai')!='') echo set_value('menit_mulai'); else echo $value['menit_mulai'];?>"/> 
			</div>
			<p class="instruct">
				Masukkan Jam Mulai Pada Kolom ini.			
			</p>
		</li>
		

		<li>
			<label class="desc">Jam Selesai *</label>
			<div>
				<input class="field text" type="text" maxlength="2" size="2" name="jam_selesai" value="<? if(set_value('jam_selesai')!='') echo set_value('jam_selesai'); else echo $value['jam_selesai'];?>"/> 
				 : <input class="field text" type="text" maxlength="2" size="2" name="menit_selesai" value="<? if(set_value('menit_selesai')!='') echo set_value('menit_selesai'); else echo $value['menit_selesai'];?>"/> 
			</div>
			<p class="instruct">
				Masukkan Jam Selesai Pada Kolom ini.			
			</p>
		</li>
		
		
		<li>
			<label class="desc">Keterangan</label>
			<div>
				<textarea rows="5" cols="30" name="keterangan" value="<? if(set_value('keterangan')!='') echo set_value('keterangan'); else echo $value['keterangan'];?>"><?php echo $value['keterangan']?></textarea>
			</div>
			<p class="instruct">
				Masukkan Keterangan Pada Kolom ini.			
			</p>
		</li>

		<li class="buttons">
		  <input id="saveForm" class="btTxt" type="submit" value="Simpan" />
		  <input name="submit" type="reset" value="Batal" />
		</li>
	</ul>
</div>
</fieldset>

<script type="text/javascript">
  $(".chzn-select").chosen();
  $(".chzn-select-deselect").chosen({allow_single_deselect:true});
</script>	
<?= form_close(); ?>
</form>
</div><!--container-->